package com.shine.commonlibrary.utils.daynightmode;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * 夜间模式辅助类，设置、获取当前属于什么模式，由SharedPreferences保存参数
 */
public class ChangeModeHelper {

    public static final int MODE_DAY = 1;

    public static final int MODE_NIGHT = 2;

    private static String Mode = "mode";

    public static void setCurrentThemeMode(Context ctx, int mode) {
        SharedPreferences sp = ctx.getSharedPreferences("config_mode", Context.MODE_PRIVATE);
        sp.edit().putInt(Mode, mode).commit();
    }

    public static int getCurrentThemeMode(Context ctx) {
        SharedPreferences sp = ctx.getSharedPreferences("config_mode", Context.MODE_PRIVATE);
        return sp.getInt(Mode, MODE_DAY);
    }
}
